gdkevents: Fallback to the event device seat
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 16 Dec 2015 18:00:39 +0000 (19:00 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 16 Dec 2015 18:47:05 +0000 (19:47 +0100)
There's places where we don't set a seat yet, plus the places
outside GTK+ where events are created, we should warn and fall
back to the master device seat with these.

gdk/gdkevents.c

index 62a4748cb0bf67cc866f6be4deb3f1a0f9fb1b7d..9ed43176aa225356bfcfd4160856bdbbf4dc1ae1 100644 (file)
@@ -2333,6 +2333,20 @@ gdk_event_get_seat (const GdkEvent *event)
     return NULL;
 
   priv = (const GdkEventPrivate *) event;
+
+  if (!priv->seat)
+    {
+      GdkDevice *device;
+
+      g_warning ("Event with type %d not holding a GdkSeat. "
+                 "It is most likely synthesized outside Gdk/GTK+\n",
+                 event->type);
+
+      device = gdk_event_get_device (event);
+
+      return device ? gdk_device_get_seat (device) : NULL;
+    }
+
   return priv->seat;
 }